writing a vector of given magnitude and direction